//
//  LBViewController.m
//  LBFadeImageLoopView
//
//  Created by liuboliu on 09/19/2021.
//  Copyright (c) 2021 liuboliu. All rights reserved.
//

#import "LBViewController.h"
#import <LBFadeImageLoopView/LBFadeImageLoopView.h>

@interface LBViewController () <LBFadeImageLoopViewDelegate>

@property (nonatomic, strong) LBFadeImageLoopView *fadeView;

@end

@implementation LBViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.fadeView];
    self.fadeView.frame = CGRectMake(30, 100, 300, 200);
    NSArray *images = @[[UIImage imageNamed:@"1"], [UIImage imageNamed:@"2"], [UIImage imageNamed:@"3"]];
    [self.fadeView loadWithImages:images];
	// Do any additional setup after loading the view, typically from a nib.
}

#pragma mark - LBFadeImageLoopViewDelegate
- (void)fadeLoopView:(LBFadeImageLoopView *)fadeLoopView clickItemAtIndex:(NSInteger)index
{
    NSLog(@"啦啦啦阿拉点击点击的第%ld张图片", index);
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - lazy load

- (LBFadeImageLoopView *)fadeView
{
    if (!_fadeView) {
        _fadeView =  [[LBFadeImageLoopView alloc] init];
        _fadeView.stayTimeInterval = 2;
        _fadeView.fadeTime = 0.5;
        _fadeView.delegate = self;
    }
    return _fadeView;
}

@end
